package base.innerclass;

// 静态内部类
public class T4 {
    public static void main(String[] args) {
        Outer04 outer04 = new Outer04();
        // 外部类访问静态内部类
        // 可以直接用类名.访问(因为是静态的，但是必须不能是私有的)
        Outer04.Inner04 inner04 = new Outer04.Inner04();
        inner04.m1();
        Outer04.Inner04 inner041 = outer04.get();
        inner041.m1();
        // 测试枚举
        System.out.println(UUU.U1.getCode());
    }
}

class Outer04 {
    public int age = 10;
    private String name = "123";
    public static int ppp = 2;
    private static int qqq = 3;

    public static void n1() {
        System.out.println("Outer n1");
    }

    public void n2() {
        System.out.println("Outer n2");
    }

    static class Inner04 {
        public void m1() {
            n1();
            System.out.println(ppp + qqq);
//            System.out.println(age); 不可访问
        }

    }

    public Inner04 get() {
        return new Inner04();
    }
}

enum UUU {

    U1(200, "ok"),
    U2(404, "error");

    private String msg;
    private int code;

    // 构造器
    UUU(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public String getMsg() {
        return msg;
    }

    public int getCode() {
        return code;
    }
}
